<?php

use yii\helpers\Html;
use yii\grid\GridView;

/* @var $this yii\web\View */
/* @var $searchModel backend\models\SearchReportModel */
/* @var $dataProvider yii\data\ActiveDataProvider */
?>
<div class="report-model-index">


    <?php // echo $this->render('_search', ['model' => $searchModel]); ?>

    <?= GridView::widget([
        'dataProvider' => $dataProvider,
        'columns' => [
                'house.house_name',
            'contacts',
            'phone',
            ['label' => '合伙人', 'value' => function ($model) {
                return empty($model->user) ? '无' : $model->user->nickname;
            }],
            'status',
            ['attribute'=>'sign','value'=>function($model){
                return $model->sign == 0 ?'未操作' : ($model->sign == 1 ?'是' : '否');
            }],
            [
                'class' => 'yii\grid\ActionColumn',
                'template' =>  \backend\components\MenuHelper::filterActionColumn('{view} {sign}'),
                'buttons' => [
                        'view' => function($url,$model){
                            if($model->sign!=1){
                                return null;
                            }
                            return Html::a('<span class="glyphicon glyphicon-eye-open"> </span>',$url,['详细']);
                        },
                    'sign' => function ($url, $model) {
        if(!empty($model->sign)){
            return null;
        }
                        return Html::a('<span class="glyphicon glyphicon-wrench"></span>', $url, ['title' => '签约']);
                    }
                ]
            ],
        ],
    ]); ?>
</div>
